/* Functions used while handling a table (tree of rows) */

// esare and empty the tree containing the info on the pages
function eraseTreeContent(treeChildrenID){
	var logger = Components.classes['@peercafe.org/pcLogger;1']
					.createInstance(Components.interfaces.pcILogger);
	try{
		var infoList = document.getElementById(treeChildrenID);
		var children = infoList.childNodes
		
		//logger.pcLog("tree items: " + infoList.childNodes.length)
		
		while(children.length != 0){
			infoList.removeChild(children.item(0)) // delete the first one (like a pop)
			children = infoList.childNodes // updateproof
		}
		
	}catch(e){
		logger.pcLog("An exception occurred in eraseTreeContent(" + treeChildrenID + "): " + e)
	}
	
}

// add the content to the given row
function appendRowChild(row, content){
	try{
		var cell = document.createElement("treecell");
		cell.setAttribute("label", content);
		row.appendChild(cell);
	} catch(e){
		logger.pcLog("An exception occurred in addRow(" + content + "): " + e)
	}
	
}